/*
 * Map.h
 *
 *  Created on: 23.11.2011
 *      Author: jan
 */

#ifndef Map_H_
#define Map_H_

#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <iostream>
#include "Point.h"
#include "MathUtil.h"
#include "DoubleProb.h"
#include "AbstractMap.h"
#include "Measurement.h"

namespace std {

class Map : public AbstractMap<DoubleProb> {
public:
	int update_cnt;
	int cnt;
	IplImage * probImg;
	bool imageShown;
	int wDiff;
	int hDiff;
	Point explored;
	Point exploreXY;
	bool first;
	Point min;
	Point max;
	Measurement * measure;
	bool firstPoint;

	//virtual fkts
	virtual Point random_free_place();
	virtual bool is_in(Point p);
	virtual bool is_free(Point p);
	//end virtual fkts

	Map(int h, int w, int picHeight, int picWidth);
	virtual ~Map();
	void explore(Point p);
	void setPoint(Point p);
	void clearPoint(Point p);
	void drawLine(Point start, Point end);
	void drawLine(Point start, Point end,bool wall);
	void updateMap(Measurement m);
	Point random_place();
	void draw();
	void redraw();
	void repaint();
	void drawRobot(Point r);
	void drawRobot(Point r, Point d);
	void drawParticles(Point p);
	void releaseImage();
	double read_sensor();
	static double distance(Point p1, Point p2);
	virtual double distance_to_nearest_beacon(Point p);

};

} /* namespace std */
#endif /* Map_H_ */
